#include "Engine.h"
#include "boost/timer.hpp"

namespace TSS
{

	Timer::Timer()
	{
		Reset();
	}

	Timer::~Timer()
	{

	}

	double Timer::getElapsedTime()
	{
		double elapsed = p_timer.elapsed() * 1000;
		return elapsed;
	}

	void Timer::Rest(double ms)
	{
		double start = getElapsedTime();
		while(start + ms > getElapsedTime())
		{
			Sleep(1);
		}
	}

	void Timer::Reset()
	{
		stopwatch_start = getElapsedTime();
	}

	bool Timer::StopWatch(double ms)
	{
		if(getElapsedTime() > stopwatch_start + (double)ms)
		{
			Reset();
			return true;
		}
		else
		{
			return false;
		}
	}
};